<template>
  <div class="logo">
    <img width="34px" height="34px" src="@/assets/logo.png" />
    <h1 v-if="!isCollapse">健康系统</h1>
  </div>
  <el-menu :default-active="route.path" :collapse="isCollapse" :collapse-transition="false" router style="height: 100vh" background-color="#d1f7ea">
    <menu-item v-for="(item, index) in props.router" :key="index" :item="item"></menu-item>
  </el-menu>
</template>

<script setup>
import { defineProps, defineEmits ,watch} from "vue";
import MenuItem from "./MenuItem.vue";
import { ref } from "vue";
import { useRoute } from "vue-router";
let route = useRoute();
let isCollapse = ref(false); //侧边栏是否折叠

let emit = defineEmits(["is-collapse"]); //父组件向子组件传值
let props = defineProps(["router","aaa"]);
// isCollapse.value=props.aaa;
watch(() => props.aaa, (newValue) => {
  isCollapse.value = newValue;
});




</script>

<style lang="scss" scoped>
.logo {
  display: flex;
  justify-content: center;
  height: 50px;
  align-items: center;
  padding: 10px 0;
  background-color: #d1f7ea;
  img {
    margin-left: -10px;
  }
  h1 {
    color: #333;
    margin-left: 10px;
    font-size: 22px;
  }
}
// .el-menu {
//   border-right: none;
// }

// 设置滚动条样式
.el-menu {
  border-right: none;
  overflow: hidden;
}
</style>
